<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        h1 {
            color: #333;
        }

        body {
            color: #333;
            background-color: #ccc;
            margin: 1em 10%;
        }

        ul li>a>img {
            width: 100px;
            border: 0;
        }

        ul li {
            float: left;
            padding: 1em;
            list-style: none;
            margin: 0px 20px 20px 0px;
            padding: 0px;
            display: inline;
        }

        ul {
            padding: 0;
        }
    </style>
</head>

<body>
    <h1>美女画廊</h1>
    <ul id="ulId">
        <li>
            <a href="img/1.jpg" title="美女A"><img src="img/1-small.jpg" alt=""></a>
        </li>
        <li>
            <a href="img/2.jpg" title="美女B"><img src="img/2-small.jpg" alt=""></a>
        </li>
        <li>
            <a href="img/3.jpg" title="美女C"><img src="img/3-small.jpg" alt=""></a>
        </li>
        <li>
            <a href="img/4.jpg" title="美女D"><img src="img/4-small.jpg" alt=""></a>
        </li>
    </ul>

    <div style="clear:both"></div>
    <img id="image" src="img/placeholder.png" alt="" width="450" />
    <p id="des">选择一个图片</p>

    <script>
        function my$(id) {
            return document.getElementById(id);
        }

        var aObjs = my$("ulId").getElementsByTagName("a");
        for (let aObjet of aObjs) {
            aObjet.onclick = function () {
                my$("image").src = this.href;
                my$("des").innerHTML = this.title;
                return false;
            }
        }
        function aClick() {

        }
    </script>
</body>

</html>